import React, { PureComponent } from 'react';
import {Icon} from 'antd'
import Body from './Body'
import HomePageIntroVideo from './HomePageIntroVideo'

// const Components ={
//   body: Body,
//   homePageIntroVideo: Body, // HomePageIntroVideo
// }

class IceAddVideo extends PureComponent {
  state = {

  }
  componentDidMount() {

  }

  render() {
    let { label, name, props, onChange } = this.props
    // let Component = Components[name]
    return (
      <div style={{padding: '10px 20px 0px'}}>
        <div>{label}</div>
        <Body {...props} handleChange={onChange}/>
      </div>
    );
  }
}

const logProps = (InputComponent) => {
  let Component = {
    'body': Body,
    'homePageIntroVideo': HomePageIntroVideo,
  }
  let currComponentName = ''
  InputComponent.prototype.componentWillReceiveProps = function(nextProps) {
    currComponentName = this.props.name;

    if(process.env.NODE_ENV === 'development') { // 开发环境
      console.log('Current props: ', this.props);
      console.log('Next props: ', nextProps);
    }
  };
  return Component[currComponentName];
}

export default IceAddVideo




